/**
 * 
 */
package galacticthrone.map.render;

import java.util.HashSet;
import java.util.Set;

import javax.media.opengl.GL;

import galacticthrone.map.data.DataMap;

// TODO JavaDoc
/**
 * @author Jaco van der Westhuizen
 *
 */
public class VisionMap
{
	DataMap actualMap;
	Set<MapIcon> icons = new HashSet<MapIcon>();
	
	public VisionMap(DataMap map)
	{
		this.actualMap = map;
	}
	
	public void add(MapIcon icon)
	{
		icons.add(icon);
	}
	
	public void renderDisplay(GL gl)
	{
		// TODO Camera bounds checking

	    for (MapIcon icon : icons)
	    {
	    	icon.prepareToRender(gl);
	    }
		
		MapIcon.mapIconAtlas.activate(gl);
		
		gl.glBegin(GL.GL_QUADS);
	    for (MapIcon icon : icons)
	    {
	    	icon.renderDisplay(gl);
	    }
	    gl.glEnd();

	    for (MapIcon icon : icons)
	    {
	    	icon.renderText(gl);
	    }
	}
	
	public void renderPicking(GL gl, float minX, float maxX, float minY, float maxY)
	{
	    for (MapIcon icon : icons)
	    {
	    	icon.renderPicking(gl);
	    }
	}

    public float getSizeX()
    {
	    return actualMap.sizeX;
    }

    public float getSizeY()
    {
	    return actualMap.sizeY;
    }
}
